****This code completes the analyses on the 2020 ANES Social Media Study data for the paper,
****"Affective polarization and Misinformation"
***Libby Jenke
**December 14, 2022
*Results in the paper are generated using Stata 14.2 for Mac

*TO OUTPUT TABLES, RUN THIS CODE FIRST. THEN, WITHOUT CLEARING STATA, RUN TIMESERIES_REPLICATION.DO. 
*DOING SO PUTS RESULTS FROM BOTH DATASETS TOGETHER IN ONE TABLE.

clear all

*cd " "
use ~/Data/socmedData_rep.dta

svyset [pweight=weight_pre]

*Define control vars
global control = "polatt polknow educ female age black hispan otherrace income midwest south west"
global control2 = "polatt female age black hispan otherrace income midwest south west"

**Table 2: In-group and out-group separately for Dems and Reps together
eststo: svy: reg misinf affpol partyex ideoex $control
	estimates store InParty1
eststo: svy: reg out_misinf affpol partyex ideoex $control	
	estimates store OutParty1

***Table 3: In-group and out-group separately for Dems
eststo: svy: reg misinf affpol partyex ideoex  $control if party<3
	est store InPartyDems1
eststo: svy: reg out_misinf affpol  partyex ideoex $control if party<3
	est store OutPartyDems1	

***Table 4: In-group and out-group separately for Reps 
eststo: svy: reg misinf affpol partyex ideoex $control if party>3
	est store InPartyRep1
eststo: svy: reg out_misinf affpol  partyex ideoex $control if party>3
	estimates store OutPartyRep1

***Table 5: Interaction with political sophistication
eststo: svy: reg misinf c.affpol##c.polsophis partyex ideoex $control2
	est store InPartySophis1
eststo: svy: reg out_misinf c.affpol##c.polsophis partyex ideoex $control2
	est store OutPartySophis1
